<template>
  <div>
    <!-- Form page
    {{ record }} -->
    <!-- {{ record }} -->

    <OForm
      :editable="editable"
      :data-info="dataInfo"
      :view-info="{ ...viewInfo, node }"
      @on-event="handleOnEvent"
    />

    <!-- <OForm
      :editable="editable"
      :data-info="data"
      :view-info="{ ...viewInfo2, node }"
      @on-event="handleOnEvent"
    /> -->
  </div>
</template>

<script>
import api from '@/odooapi'
import OForm from '@/components/ONode/OForm.vue'

// import ONode from '@/components/ONode/ONode'

// eslint-disable-next-line no-unused-vars
const cp = val => JSON.parse(JSON.stringify(val))
export default {
  name: 'FormPage',
  components: { OForm },
  mixins: [],

  props: {
    editable: { type: Boolean, default: false },
    viewInfo: {
      type: Object,
      default: () => {
        return {}
      }
    },

    dataInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },

  data() {
    return {}
  },

  computed: {
    record() {
      return this.dataInfo.record || {}
    },
    node() {
      return api.Views.form.view_node(this.viewInfo)
    }
  },

  created() {},

  methods: {
    handleOnEvent(event_name, ...args) {
      console.log('node,handleOnEvent,  ', event_name, ...args)
      this.$emit('on-event', event_name, ...args)
    }
  }
}
</script>

<style scoped></style>
